package vn.fpt.fsoft.cuongn.faces.controller;

import java.sql.SQLException;
import java.util.ArrayList;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import vn.fpt.fsoft.cuongn.faces.model.Account;
import vn.fpt.fsoft.cuongn.faces.service.ListAccountService;
import vn.fpt.fsoft.cuongn.faces.serviceimpl.ListAccountServiceImpl;

@ManagedBean(name = "listAccountController", eager = true)
@RequestScoped
public class ListAccountController {
	private Integer id;
	private String tenDangNhap;
	private String passWord;
	private String hoTen;
	private String email;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTenDangNhap() {
		return tenDangNhap;
	}

	public void setTenDangNhap(String tenDangNhap) {
		this.tenDangNhap = tenDangNhap;
	}

	public String getPassWord() {
		return passWord;
	}

	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}

	public String getHoTen() {
		return hoTen;
	}

	public void setHoTen(String hoTen) {
		this.hoTen = hoTen;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	
	public ArrayList<Account> getAccounts(){
		ListAccountService listAccountService = new ListAccountServiceImpl();
		try {
			return listAccountService.getAccounts();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
